﻿using Corina.Datamodel.Entities;
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Corina.Cydee.Apphub.Viewmodels
{
    public class DataContainer : ViewmodelBase
    {
        private string _viewUrl = "/Home";
        public string ViewUrl
        {
            get { return _viewUrl; }
            set
            {
                _viewUrl = value;
                RaisePropertyChanged(() => ViewUrl);
            }
        }

        private ManagerInfo _currentAccount;
        public ManagerInfo CurrentAccount
        {
            get
            {
                return _currentAccount;
            }
            set
            {
                _currentAccount = value;
                RaisePropertyChanged(() => CurrentAccount);
                RaisePropertyChanged(() => IsValid);
                AccountChanged.Invoke(this, EventArgs.Empty);
            }
        }

        private RoleInfo _currentRole;
        public RoleInfo CurrentRole
        {
            get { return _currentRole; }
            set
            {
                _currentRole = value;
                RaisePropertyChanged(() => CurrentRole);
            }
        }

        public bool IsValid
        {
            get { return CurrentAccount != null; }
        }

        public event EventHandler<EventArgs> AccountChanged = delegate { };

        public virtual void GotoView(string code)
        {

        }

        public virtual void GotoUrl(string url)
        {
            ViewUrl = url;
        }
    }
}
